package com.mg.admin.constants;

/**
 * Created by Administrator on 2017-08-31.
 */
public enum ResultEnum{

    SUCCESS(0,""),
    VERIFY_ERROR(9997,"验证失败"),
    OTHER_ERROR(9999,"其他异常"),
    SAVE_ERROR(9998, "保存失败"),
    USERNAME_PASSWORD_ERROR(1000,"用户名或密码不正确或已被禁用"),
    USER_HAS_LOCKER(1001,"账号已锁定"),
    USER_HAS_EXIST(1002, "账号已经存在");



    private int code;
    private String msg;

    ResultEnum(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public int getCode() {
        return code;
    }


    public String getMsg() {
        return msg;
    }


    //根据index获取value
    public static String getValue(int code){
        for (ResultEnum c : ResultEnum.values()) {
            if (c.code == code) {
                return c.msg;
            }
        }
        return "";
    }



}
